package com.csw.mybatisSpringboot.config.page;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

public class PageResultUtil {

    public static <T> PageResult<T> getPageResult(Page<T> param) {
        PageResult<T> result = new PageResult<>();
        if (param != null) {
            result.setTotalPage(param.getPages());
            result.setTotal(param.getTotal());
            result.setItems(param.getRecords());
            result.setPageNo((int) param.getCurrent());
            result.setPageSize((int) param.getSize());
        }
        return result;
    }

}
